package com.zzyl.serve.controller.member;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.zzyl.common.core.domain.R;
import com.zzyl.serve.dto.UserLoginRequestDto;
import com.zzyl.serve.vo.LoginVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zzyl.common.annotation.Log;
import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.enums.BusinessType;
import com.zzyl.serve .domain.FamilyMember;
import com.zzyl.serve .service.IFamilyMemberService;
import com.zzyl.common.utils.poi.ExcelUtil;
import com.zzyl.common.core.page.TableDataInfo;

/**
 * 老人家属Controller
 * 
 * @author lcl
 * @date 2025-05-08
 */
@RestController
@RequestMapping("/member/user")
@Api(tags = "老人家属相关接口")
public class FamilyMemberController extends BaseController {
    @Autowired
    private IFamilyMemberService familyMemberService;

    @PostMapping("/login")
    @ApiOperation("小程序登录")
    public AjaxResult login(@RequestBody UserLoginRequestDto userLoginRequestDto) {
        LoginVo loginVo = familyMemberService.login(userLoginRequestDto);
        return AjaxResult.success(loginVo);
    }


//    /**
//     * 查询老人家属列表
//     */
//    @PreAuthorize("@ss.hasPermi('nursing: FamilyMember:list')")
//    @GetMapping("/list")
//    @ApiOperation(value = "获取老人家属列表")
//    public TableDataInfo<List<FamilyMember>> list(FamilyMember familyMember)
//    {
//        startPage();
//        List<FamilyMember> list = familyMemberService.selectFamilyMemberList(familyMember);
//        return getDataTable(list);
//    }
//
//    /**
//     * 导出老人家属列表
//     */
//    @PreAuthorize("@ss.hasPermi('nursing: FamilyMember:export')")
//    @Log(title = "老人家属", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    @ApiOperation("导出老人家属列表")
//    public void export(HttpServletResponse response, FamilyMember familyMember) {
//        List<FamilyMember> list = familyMemberService.selectFamilyMemberList(familyMember);
//        ExcelUtil<FamilyMember> util = new ExcelUtil<FamilyMember>(FamilyMember.class);
//        util.exportExcel(response, list, "老人家属数据");
//    }
//
//    /**
//     * 获取老人家属详细信息
//     */
//    @PreAuthorize("@ss.hasPermi('nursing: FamilyMember:query')")
//    @GetMapping(value = "/{id}")
//    @ApiOperation("获取老人家属详细信息")
//    public R<FamilyMember> getInfo(@ApiParam(value = "老人家属ID", required = true)
//            @PathVariable("id") Long id)
//    {
//        return R.ok(familyMemberService.selectFamilyMemberById(id));
//    }
//
//    /**
//     * 新增老人家属
//     */
//    @PreAuthorize("@ss.hasPermi('nursing: FamilyMember:add')")
//    @Log(title = "老人家属", businessType = BusinessType.INSERT)
//    @PostMapping
//    @ApiOperation("新增老人家属")
//    public AjaxResult add(@ApiParam(value = "老人家属实体", required = true) @RequestBody FamilyMember familyMember)
//    {
//        return toAjax(familyMemberService.insertFamilyMember(familyMember));
//    }
//
//    /**
//     * 修改老人家属
//     */
//    @PreAuthorize("@ss.hasPermi('nursing: FamilyMember:edit')")
//    @Log(title = "老人家属", businessType = BusinessType.UPDATE)
//    @PutMapping
//    @ApiOperation("修改老人家属")
//    public AjaxResult edit(@ApiParam(value = "老人家属实体", required = true) @RequestBody FamilyMember familyMember)
//    {
//        return toAjax(familyMemberService.updateFamilyMember(familyMember));
//    }
//
//    /**
//     * 删除老人家属
//     */
//    @PreAuthorize("@ss.hasPermi('nursing: FamilyMember:remove')")
//    @Log(title = "老人家属", businessType = BusinessType.DELETE)
//	@DeleteMapping("/{ids}")
//    @ApiOperation("删除老人家属")
//    public AjaxResult remove(@ApiParam(value = "要删除的数据id的数组") @PathVariable Long[] ids)
//    {
//        return toAjax(familyMemberService.deleteFamilyMemberByIds(ids));
//    }
}
